package edu.nyu.msis.ds;

import java.util.HashMap;

public class SymbolTable {
	HashMap<String, Integer> myTable;

	/**
	 * @param myTable
	 */
	public SymbolTable(HashMap<String, Integer> myTable) {
		super();
		this.myTable = myTable;
	}

	public SymbolTable()
	{
		super();
		this.myTable = new HashMap<String, Integer>();
	}

	public HashMap<String, Integer> getMyTable() {
		return myTable;
	}

	public void setMyTable(HashMap<String, Integer> myTable) {
		this.myTable = myTable;
	}

	public boolean isSymbolPresent (String symbol) {
		return myTable.containsKey(symbol);
	}

	public boolean addToSymbolTable (String symbol, Integer location) {
		if (this.isSymbolPresent(symbol)) {
			return false;
		}
		myTable.put(symbol, location);
		return true;
	}
}
